<?php

header('Content-type: application/json');
$status = array(
    'type' => 'success',
    'message' => 'Thank you for contacting us. We will respond as early as possible.'
);

$name = @trim(stripslashes($_POST['name']));
$email = @trim(stripslashes($_POST['email']));
$subject = @trim(stripslashes($_POST['subject']));
$message = @trim(stripslashes($_POST['message']));

if (!empty($name) and !empty($email) and !empty($subject) and !empty($message)) {

    $email_from = $email;
    $email_to = 'fowz81@gmail.com,ifrasfaleel@gmail.com,shareek.now@gmail.com'; //replace with your email

    $body = 'Name: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n" . 'Subject: ' . $subject . "\n\n" . 'Message: ' . $message;
    $email_subject = "Email from miyako.lk: " . $subject;
    $success = @mail($email_to, $email_subject, $body, 'From: <' . $email_from . '>');
}
if ($success == 1) {
    header('Location: contactus.php?status=1#msg');
    //echo json_encode($status);
    //die;
} else {
    header('Location: contactus.php?status=0#msg');
}
    
    
